package com.test.realcityalfa.actionbar;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuInflater;


public class ActionBarBuilder implements ActionBarInterface{
	ActionBar _bar;	
	SherlockActivity _activity; 
	
	
	public ActionBarBuilder(SherlockActivity activity)
	{
		this._activity = activity;
	}
	
	@Override
	public ActionBar createActionBar()
	{
		_bar = this._activity.getSupportActionBar();
		applyActionBarSettings(_bar, new ActionBarSettings());
		
		return _bar;
	}
	
	public void applyActionBarSettings(ActionBar bar, ActionBarSettings actionBarSettings) 
	{	
		bar.setTitle(actionBarSettings.getTitle());
		bar.setHomeButtonEnabled(actionBarSettings.getHomeButtonEnabled());
		bar.setNavigationMode(actionBarSettings.getNavigationMode());
		if(!actionBarSettings.getVisibility()){bar.hide();}				
		
	}

}
